home *** CD-ROM | disk | FTP | other *** search
/ Sunday Savers: Sharing Fun! I Know My Savior Lives / Sunday Savers: Sharing Fun! I Know My Savior Lives.iso / mac / Xtras / PrintOMatic MX 1.7.3 / PrintOMatic MX (OS X) / -PrintOMatic MX Demo.dir / 00030.txt < prev    next >
Encoding:
Text File  |  2004-04-07  |  2.6 KB  |  45 lines

  1. Creating, Destroying and Resetting Documents
  2.  
  3. The following commands are used to create and reset PrintOMatic documents:
  4.  
  5.     new        creates a new document
  6.     forget    never call this directly
  7.     reset     resets a document to defaults
  8.  
  9. To destroy a document, never call the forget method of an Xtra explicitly. Instead, use the following syntax to explicitly get rid of a document object when you are done using it:
  10.  
  11.     set doc = 0Creating Document Objects with new
  12.  
  13. Syntax:    set doc = new(xtra "PrintOMatic") (full version)
  14.         or set doc = new(xtra "PrintOMatic_Lite") (lite version)
  15.  
  16. The new command is used to create a new instance of the PrintOMatic or PrintOMatic Lite MX Xtra. The newly created instance is called a document object, since it represents a printable "document": a collection of items that are printed together in a single print job by the Xtra.
  17.  
  18.  Once your document has been created and stored in a Lingo variable, its settings can be modified, items can be appended to the document, and it can be printed or displayed in a print preview window.
  19.  
  20. Important Note:
  21.  
  22. new will return an error code instead of a document object if there is no currently selected printer, or a printing error occurs. Always check the result of new with the objectP() function to make sure you have a valid Xtra instance before continuing!
  23.  
  24. Example:
  25.  
  26. The following code example creates a new document, sets the page orientation to landscape mode, appends an image with a caption to the document, and prints the document:
  27.  
  28.     set doc = new(xtra "PrintOMatic") -- or new (xtra "PrintOMatic_Lite")
  29.     if not objectP(doc) then exit
  30.     append doc, member "picture", TRUE
  31.     append doc, RETURN & "Image printed by my sample code.", TRUE
  32.     if doJobSetup (doc) = TRUE then print doc
  33.     set doc = 0forget
  34.  
  35. You should never call the forget command directly for an instance of a Lingo Xtra. Director automatically calls forget when an instance of an Xtra needs to be disposed; calling forget yourself can lead to memory leaks or crashing.
  36.  
  37. Use the following syntax to explicitly get rid of a document object when you are done using it:
  38.  
  39.     set doc = 0
  40.  
  41. Where doc is the document object you want to dispose of. Explicitly disposing of documents is optional, since Director will automatically get rid of the object when it's no longer referenced anyway.reset
  42.  
  43. Syntax: reset document
  44.  
  45. The reset command is used to reset an instance of a document object. All the contents of the document and any existing pages are deleted. The page settings, such as margins and page orientation, as well as the progress dialog settings, are maintained; they are NOT reset to default values.